<?php function divPage($total = 0,$currentPage = 0,$div = 5,$rows = 10,$attribute){
			if(!$total || !$rows || !$div || $total<=$rows) return false;
			$nPage = floor($total/$rows) + (($total%$rows)?1:0);
			$nDiv  = floor($nPage/$div) + (($nPage%$div)?1:0);
			$currentDiv = floor($currentPage/$div) ;
			$sPage = '';
			if($currentDiv) {
				$sPage .= ' &nbsp;<a href="'.$attribute.'0" style="text-decoration:none" > First </a>&nbsp; ';
				$sPage .= ' &nbsp;<a href="'.$attribute.($currentDiv*$div - 1).'" style="text-decoration:none">previus</a>&nbsp; ';
			}
			$count =($nPage<=($currentDiv+1)*$div)?($nPage-$currentDiv*$div):$div;
			for($i=0;$i<$count;$i++){
				$page = ($currentDiv*$div + $i);
				if($page==$currentPage){
						$sPage .= ' [ '.($page==0?'Trang đầu':$page).' ] ';
				}else{
					$sPage .= ' &nbsp;<strong><a href="'.$attribute.($currentDiv*$div + $i ).'" style="text-decoration:none" >'.($page==0?'Trang đầu':$page).'</a></strong>&nbsp; ';
					
				}
			}
			if($currentDiv < $nDiv - 1){
				$sPage .= ' &nbsp;<a href="'.$attribute.(($currentDiv+1)*$div  ).'" style="text-decoration:none">Next</a>&nbsp; ';
				$sPage .= ' &nbsp;<a href="'.$attribute.(($nDiv-1)*$div + 1 ).'" style="text-decoration:none">Last</a>&nbsp; ';
			}
			return $sPage ;	}
		function divPagess($total = 0,$currentPage = 0,$div = 5,$rows = 10,$attribute){
			if(!$total || !$rows || !$div || $total<=$rows) return false;
			$nPage = floor($total/$rows) + (($total%$rows)?1:0);
			$nDiv  = floor($nPage/$div) + (($nPage%$div)?1:0);
			$currentDiv = floor($currentPage/$div) ;
			$sPage = '';
			if($currentDiv) {
				$sPage .= ' &nbsp;<a href="'.$attribute.'0/#fragment-3" style="text-decoration:none" > Fi/#fragment-3rst </a>&nbsp; ';
				$sPage .= ' &nbsp;<a href="'.$attribute.($currentDiv*$div - 1).'/#fragment-3" style="text-decoration:none">previus</a>&nbsp; ';
			}
			$count =($nPage<=($currentDiv+1)*$div)?($nPage-$currentDiv*$div):$div;
			for($i=0;$i<$count;$i++){
				$page = ($currentDiv*$div + $i);
				if($page==$currentPage){
						$sPage .= ' [ '.($page==0?'Trang đầu':$page).' ] ';
				}else{
					$sPage .= ' &nbsp;<strong><a href="'.$attribute.($currentDiv*$div + $i ).'/#fragment-3" style="text-decoration:none" >'.($page==0?'Trang đầu':$page).'</a></strong>&nbsp; ';
					
				}
			}
			if($currentDiv < $nDiv - 1){
				$sPage .= ' &nbsp;<a href="'.$attribute.(($currentDiv+1)*$div  ).'/#fragment-3" style="text-decoration:none">Next</a>&nbsp; ';
				$sPage .= ' &nbsp;<a href="'.$attribute.(($nDiv-1)*$div + 1 ).'/#fragment-3" style="text-decoration:none">Last</a>&nbsp; ';
			}
			return $sPage ;	}
//----------------------------------		
		function divPage_h($total = 0,$currentPage = 0,$div = 5,$rows = 10,$attribute,$tag){		
			if(!$total || !$rows || !$div || $total<=$rows) return false;
			$nPage = floor($total/$rows) + (($total%$rows)?1:0);
			$nDiv  = floor($nPage/$div) + (($nPage%$div)?1:0);
			$currentDiv = floor($currentPage/$div) ;
			$sPage = ''; 
			if($currentDiv) {
				$sPage .= ' &nbsp;<a href="'.$attribute.'0/'.$tag.'" style="text-decoration:none" > Fi/#fragment-3rst </a>&nbsp; ';
				$sPage .= ' &nbsp;<a href="'.$attribute.($currentDiv*$div - 1).'/'.$tag.'" style="text-decoration:none">previus</a>&nbsp; ';
			}
			$count =($nPage<=($currentDiv+1)*$div)?($nPage-$currentDiv*$div):$div;
			for($i=0;$i<$count;$i++){
				$page = ($currentDiv*$div + $i);
				if($page==$currentPage){
						$sPage .= ' [ '.($page==0?'Trang đầu':$page).' ] ';
				}else{
					$sPage .= ' &nbsp;<strong><a href="'.$attribute.($currentDiv*$div + $i ).'/'.$tag.'" style="text-decoration:none" >'.($page==0?'Trang đầu':$page).'</a></strong>&nbsp; ';
					
				}
			}
			if($currentDiv < $nDiv - 1){
				$sPage .= ' &nbsp;<a href="'.$attribute.(($currentDiv+1)*$div  ).'/'.$tag.'" style="text-decoration:none">Next</a>&nbsp; ';
				$sPage .= ' &nbsp;<a href="'.$attribute.(($nDiv-1)*$div + 1 ).'/'.$tag.'" style="text-decoration:none">Last</a>&nbsp; ';
			}
			
			return $sPage ;	}
			
?>